package com.chen.controller;

import com.chen.service.CoachService;
import com.chen.service.impl.CoachServiceImpl;
import com.chen.vo.Result;
import com.chen.vo.param.CoachParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:chenao
 * @DATE:2022/3/13 16:21
 */
@RestController  //返回JSON格式的数据
@RequestMapping("coach")
public class CoachController {

    @Autowired
    private CoachService coachService;

    @PostMapping("save")
    public Result saveCoach(@RequestBody CoachParam param){
        return this.coachService.saveCoach(param);
    }

    @PostMapping("list")
    public Result listCoach(@RequestBody CoachParam param){
        return coachService.listCoach(param);
    }

    @PostMapping("delete")
    public Result deleteCoach(@RequestBody CoachParam param){
        return coachService.deleteCoachById(param.getId());
    }
}
